/*
*    Phantom Test Driver v2.0 GUI Automation Software
*    Copyright (C) 2009  John C. Van Arsdall (john@phantomtest.com)
*
*    This program is free software; you can redistribute it and/or modify
*    it under the terms of the GNU General Public License as published by
*    the Free Software Foundation; either version 2 of the License, or
*    (at your option) any later version.
*
*    This program is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU General Public License for more details.
*
*    You should have received a copy of the GNU General Public License along
*    with this program; if not, write to the Free Software Foundation, Inc.,
*    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
/*
 * PTDRecorderFrame.java
 *
 * Created on April 6, 2007, 9:50 AM
 */

package ptd;

import javax.swing.ImageIcon;
import ssi_colorizer.*;
import java.io.*;
/**
 *
 * @author  John
 */
public class PTDRecorderFrame extends javax.swing.JFrame {
    
    /** Creates new form PTDRecorderFrame */
    
    private PTDScriptPane myPane;
    
    //PTDScriptPane aPane = getActiveScriptPane();
    public PTDRecorderFrame(PTDScriptPane inPane) {
        
        if(inPane == null){
            return;  // Exit out...
        }
        
        myPane = inPane;
        
        initComponents();
        
        
        ImageIcon a = PTDImageLoader.getImageIcon(PTDImageLoader.IMG_PTD_ICON);
        setIconImage(a.getImage());
        this.setSize(300, 100);
        
        RecorderLabel.setText("PTD Script Recorder Controls");
        StartButton.setText("Start");
        StopButton.setText("Stop");
        ExitButton.setText("Exit");
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        RecorderLabel = new javax.swing.JLabel();
        StartButton = new javax.swing.JButton();
        StopButton = new javax.swing.JButton();
        ExitButton = new javax.swing.JButton();

        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("PTD Script Recorder Controls");
        RecorderLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        getContentPane().add(RecorderLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 200, -1));

        StartButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                StartButtonActionPerformed(evt);
            }
        });

        getContentPane().add(StartButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 20, 74, -1));

        StopButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                StopButtonActionPerformed(evt);
            }
        });

        getContentPane().add(StopButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 20, 70, -1));

        ExitButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ExitButtonActionPerformed(evt);
            }
        });

        getContentPane().add(ExitButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 20, 70, -1));

        pack();
    }
    // </editor-fold>//GEN-END:initComponents

    private void StartButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_StartButtonActionPerformed
        PTDRecorderThread aThread = new PTDRecorderThread(myPane);
        aThread.start();
    }//GEN-LAST:event_StartButtonActionPerformed

    private void StopButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_StopButtonActionPerformed
// TODO add your handling code here:
    }//GEN-LAST:event_StopButtonActionPerformed

    private void ExitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ExitButtonActionPerformed
        dispose();
    }//GEN-LAST:event_ExitButtonActionPerformed
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                //new PTDRecorderFrame().setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton ExitButton;
    private javax.swing.JLabel RecorderLabel;
    private javax.swing.JButton StartButton;
    private javax.swing.JButton StopButton;
    // End of variables declaration//GEN-END:variables
    
}
